﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IData
{
    public interface IDAL<T>
    {
        /// <summary>
        /// 新增数据接口
        /// </summary>
        /// <param name="t">新增实体</param>
        /// <param name="filter">过滤字段</param>
        /// <returns>受影响行数</returns>
        int AddData(T t,string filter);

        /// <summary>
        /// 修改数据接口
        /// </summary>
        /// <param name="t">更新实体</param>
        /// <param name="filter">过滤字段</param>
        /// <param name="where">条件</param>
        /// <returns>受影响行数</returns>
        int EditData(T t,string filter,string where);

        /// <summary>
        /// 删除数据接口
        /// </summary>
        /// <param name="t">更新实体</param>
        /// <param name="where">条件</param>
        /// <returns>受影响行数</returns>

        int DelData(T t, string where);

        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="t">查询实体</param>
        /// <param name="where">条件</param>
        /// <param name="pageNo">页数</param>
        /// <param name="page">每页显示多少</param>
        /// <returns>实体集合</returns>
        List<T> Pager(T t, string where, int pageNo, int page);

        /// <summary>
        /// 查询实体
        /// </summary>
        /// <param name="t">实体</param>
        /// <param name="where">条件</param>
        /// <returns>实体集合</returns>
        List<T> QueryList(T t, string where);

        /// <summary>
        /// 查询实体
        /// </summary>
        /// <param name="t">实体</param>
        /// <param name="where">条件</param>
        /// <returns>实体</returns>
        T Query(T t, string where);

        /// <summary>
        /// 自定义查询
        /// </summary>
        /// <param name="sqltext">sql语句</param>
        List<T> Query(string sqltext);


    }
}
